package exercise1;

import java.util.Scanner;
public class No5_21{
    public static void main(String[] args){
        double[] rate=new double[24];//利率
        int year ; //年数
        double money ; //贷款总额
        double month_pay ;//月付款
        double total_pay; //总付款

        Scanner input =new Scanner(System.in);

        System.out.println("Loan Amount: ");
        money=input.nextDouble();

        System.out.println("Number of Years: ");
        year=input.nextInt();


        System.out.println("Interest Rate        Monthly Payment        Total Payment");

        for(int i=0;i<24;i++)
        {
            rate[i]=(5+0.125*i)/100;
            System.out.print(rate[i]);
            rate[i]=rate[i]/12;
            month_pay=(money*rate[i])/(1-(1/(Math.pow(1+rate[i],year*12))));
            total_pay=month_pay*year*12;
            System.out.print("                 "+month_pay+"        "+total_pay);
            System.out.println();
        }


    }
}
